home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / util2 / pgp22src.zip / CONTRIB / MH / PGPMAIL.MH
Text File  |  1993-03-07  |  2KB  |  69 lines

  1. Subject: Re: Suggestion...
  2. Date: Sun, 10 Jan 93 22:56:53 EST
  3. From: disser@engin.umich.edu (David Disser)
  4. Lines: 62
  5.  
  6.  
  7. Here's a start for mh + MIME users: an "editor" that runs out of the MH
  8. "What now?" prompt, and PGP encodes your message in a nice mhn-processable
  9. format.  Note that this works only on MH 6.7.2-MIME+mtr or later.
  10.  
  11. Call this script "pgpedit" and make links to it called: pgpe, pgpes, pgpk,
  12. pgka.
  13.  
  14. After you're done writing your message, type "edit pgpe" at the What now?
  15. prompt, it will try to figure out who you're sending to, encode with their
  16. key if you have it, and format it for MHN.  Then type "edit mhn" and voila
  17. your message is ready to go.  The type is "text/x-pgp" and needs an
  18. .mh_profile line like:
  19.  
  20. mhn-show-text/x-pgp: pgp -m %F
  21.  
  22. You can call it by different names for different options, notable "pgpk" to
  23. send someone your public key, or "pgpka" to send the whole keyring.
  24. Anyway, here's the script.
  25.  
  26. #!/bin/sh
  27.  
  28. case `basename $0` in
  29.     pgpes) opt="-feast" ;;
  30.     pgps) opt="-staf +clearsig=on" ;;
  31.     pgpe) opt="-feat" ;;
  32.     pgpka) pgp -kxa "" pubkey$$
  33.                 (echo '#<text/x-pgp';cat pubkey$$.asc;echo '#') >> $*
  34.                 rm -f pubkey$$.asc
  35.                 exit 0 ;;
  36.     pgpk)    pgp -kxa $USER pubkey$$
  37.         (echo '#<text/x-pgp';cat pubkey$$.asc;echo '#') >> $* 
  38.         rm -f pubkey$$.asc 
  39.         exit 0 ;;
  40. esac
  41.  
  42. if head -20 $* | grep -s '^--------$' ; then
  43.     sed -ne '1,/^--------$/p' $* > header$$
  44.     sed -e '1,/^--------$/d' $* > body$$
  45. else
  46.     sed -ne '1,/^$/p' $* > header$$
  47.     sed -e '1,/^$/d' $* > body$$
  48. fi
  49.  
  50. to=`sed -ne 's/^[tT]o: //p' header$$`
  51.  
  52. if [ -n "$to" ] ; then
  53.     if pgp -kv "$to" 2>&1 | grep -s '^pub' ; then
  54.         echo Using public key for $to.
  55.         opt="$opt $to"
  56.     fi
  57. fi
  58.  
  59. (cat header$$;echo '#<text/x-pgp';pgp $opt < body$$;echo '#')  > $*
  60. rm -f header$$ body$$
  61.  
  62.  
  63. --
  64.  
  65. ) Dave Disser                 UM-CAEN User Services    
  66. ) disser@engin.umich.edu      229 Chrysler Center    
  67. ) (313) 763-3067              Ann Arbor, MI 48109-2092
  68.  
  69.